
function example(id){
	
	 var theadHeight = $('#'+id+' thead').outerHeight(true);
	 //console.log(theadHeight);
     var scrollY = 550 - theadHeight;
     //console.log(scrollY);
     $('#'+id).mobileFixedColumnsTable({
         'sScrollY': scrollY,
         'sScrollX': '2100px',
         'bScrollCollapse': true,
         'oLanguage': {
             'sInfo': ''
         }
     },{
           fixedColumnsOptions: { 
               iLeftColumns: 1
           }
     })
}
  
//险种信息
function xzxx(){
	
	var contractId = getQueryString('contractId');
	//$("#xzlb").remove();
	padMarketing.ajaxNormal(
		'/pad_marketing/myPolicy/getInsurances.action',
		//jsonParam,4641720   sessionStorage.contractId
		{contractId:contractId},
		function(data){
			var html="";
			var html2="";
			/*html+='<table class="table browser-table table-bordered table-striped table-center table-iframe" id="xzlb">';
			html+='<thead>';
			html+='<tr class="primary">';
			html+='<th>险种名称</th>';
			html+='<th>被保险人</th>';
			html+='<th>保额(元)</th>';
			html+='<th>险种状态</th>';
			html+='<th>生效日-零时起</th>';
			html+='<th>满期日-24时止</th>';
			html+='<th>传统保费（元）</th>';
			html+='<th>基本保费（元）</th>';
			html+='<th>额外保费（元）</th>';
			html+='<th>每期保费（元）</th>';
			html+='<th>交费年限</th>';
			html+='</tr>';
			html+='</thead>';
			html+='<tbody>';
			html+='</tbody>';
			html+='</table>';
			$("#xzlbk").html(html);*/
			if(data.length>0){
				for(var i=0;i<data.length;i++){
					html2+='<tr>';
					html2+='<td>'+$.trim(data[i].COVER_CODE)+'</td>';//险种名称
					html2+='<td>'+$.trim(data[i].INS_NAME)+'</td>';//被保险人
					html2+='<td>'+$.trim(data[i].SUM_INSURED_WHOLE_COVER)+'</td>';//保额(元)
					html2+='<td>'+$.trim(data[i].COVER_STATUS)+'</td>';//险种状态
					html2+='<td>'+$.trim(data[i].COVER_START_DATE?new Date(data[i].COVER_START_DATE).Format("yyyy-MM-dd"):'')+'</td>';//生效日-零时起
					html2+='<td>'+$.trim(data[i].COVER_END_DATE?new Date(data[i].COVER_END_DATE).Format("yyyy-MM-dd"):'')+'</td>';//满期日-24时止
					html2+='<td>'+$.trim(data[i].STD_FRE_PREMIUM?data[i].STD_FRE_PREMIUM:"0")+'</td>';//传统保费（元）
					html2+='<td>'+$.trim(data[i].BASIC_PREMIUM?data[i].BASIC_PREMIUM:'0')+'</td>';//基本保费（元）
					html2+='<td>'+$.trim(data[i].EXTRA_PREMIUM?data[i].EXTRA_PREMIUM:'0')+'</td>';//额外保费（元）
					html2+='<td>'+$.trim(data[i].INF_FRE_PREMIUM)+'</td>';//每期保费（元）
					html2+='<td>'+$.trim(data[i].PREMIUM_TERM)+'</td>';//交费年限
					html2+='</tr>';						
				}
				$("#xzlb tbody").html(html2);
				example("xzlb");
				for(var j=0;j<$("#xzlb tbody td").length;j++){
					if($("#xzlb tbody td").eq(j).text()=="undefined"){
						$("#xzlb tbody td").eq(j).text("");
					}
				}
			}
		},
		function(){
													
		},
		true,
		true,
		'呦!你的保单很多哦!'
	)
}

//收退费
function stf(){
	//$("#stflb tbody td").empty();
	var contractId = getQueryString('contractId');
	padMarketing.ajaxNormal(
		'/pad_marketing/myPolicy/getExpenses.action',
		{contractId:contractId},
		function(data){
			//console.log(data);
			var html = '';
			var html2='';
			/*html+='<table class="table browser-table table-bordered table-striped table-center table-iframe" id="stflb">';
			html+='<thead>';
			html+='<tr class="primary">';
			html+='<th>记账日期</th>';
			html+='<th>描述</th>';
			html+='<th>收费币种</th>';
			html+='<th>收费金额</th>';
			html+='<th>退费币种</th>';
			html+='<th>退费金额</th>';
			html+='<th>方法</th>';
			html+='<th>支付状态</th>';
			html+='<th>结算日期</th>';
			html+='</tr>';
			html+='</thead>';
			html+='<tbody>';
			html+='</tbody>';
			html+='</table>';
			$("#stfk").html(html);*/
			if(data.length>0){
				for(var i=0;i<data.length;i++){
					html2+='<tr>';
					html2+='<td>'+$.trim(data[i].EFFECTIVE_DATE?new Date(data[i].EFFECTIVE_DATE).Format("yyyy-MM-dd"):'')+'</td>';//记账日期
					html2+='<td>'+$.trim(data[i].MOVEMENT_CODE)+'</td>';//描述
					html2+='<td>'+$.trim(data[i].IN_CURRENCY?"人民币":'')+'</td>';//收费币种
					html2+='<td>'+$.trim(data[i].IN_CURRENCY_AMT)+'</td>';//收费金额
					html2+='<td>'+$.trim(data[i].OUT_CURRENCY?"人民币":'')+'</td>';//退费币种
					html2+='<td>'+$.trim(data[i].OUT_CURRENCY_AMT)+'</td>';//退费金额
					html2+='<td>'+$.trim(data[i].PAY_MODE)+'</td>';//方法
					html2+='<td>'+$.trim(data[i].PAID_FLAG)+'</td>';//支付状态
					html2+='<td>'+$.trim(data[i].SETTLE_DATE?new Date(data[i].SETTLE_DATE).Format("yyyy-MM-dd"):'')+'</td>';//结算日期
					html2+='</tr>';
				}
				$("#stflb tbody").html(html2);
				example("stflb");
				for(var j=0;j<$("#stflb tbody td").length;j++){
					if($("#stflb tbody td").eq(j).text()=="undefined"){
						$("#stflb tbody td").eq(j).text("");
					}
				}
			}
		},
		function(){
										
		},
		true,
		true,
		'呦!你的保单很多哦!'
	)
}

//投连账户信息
function tlxx(){
	//$("#tllb tbody td").empty();
	var contractId = getQueryString('contractId');
	padMarketing.ajaxNormal(
			'/pad_marketing/myPolicy/getAccounts.action',
			{contractId:contractId},
			function(data){
				var html="";
				var html2="";
				/*html+='<table class="table browser-table table-bordered table-striped table-center table-iframe" id="tllb">';
				html+='<thead>';
				html+='<tr class="primary">';
				html+='<th>账户名称</th>';
				html+='<th>单位数</th>';
				html+='<th>最新卖出价</th>';
				html+='<th>最新买入价</th>';
				html+='<th>账户价值</th>';
				html+='</tr>';
				html+='</thead>';
				html+='<tbody>';
				html+='</tbody>';
				html+='</table>';
				$("#tlk").html(html);*/
				if(data.length>0){
					for(var i=0;i<data.length;i++){
						html2+='<tr>';
						html2+='<td>'+$.trim(data[i].FUND_FULL_NAME)+'</td>';//账户名称
						html2+='<td>'+$.trim(data[i].TOTAL_UNITS)+'</td>';//单位数
						html2+='<td>'+$.trim(data[i].BID_PRICE.toFixed(4))+'</td>';//最新卖出价
						html2+='<td>'+$.trim(data[i].OFFER_PRICE.toFixed(4))+'</td>';//最新买入价
						html2+='<td>'+$.trim(formatMoney(data[i].TOTAL_VALUE,2))+'</td>';//账户价值
						html2+='</tr>';
					}
					$("#tllb tbody").html(html2);
					example("tllb");
					for(var j=0;j<$("#tllb tbody td").length;j++){
						if($("#tllb tbody td").eq(j).text()=="undefined"){
							$("#tllb tbody td").eq(j).text("");
						}
					}
				}
				//console.log(data);
//				data = [{BID_PRICE:"333",FUND_FULL_NAME:"账户名称",OFFER_PRICE:"123123",TOTAL_UNITS:"333",TOTAL_VALUE:"82727"},{BID_PRICE:"888",FUND_FULL_NAME:"账户名称",OFFER_PRICE:"123123",TOTAL_UNITS:"666",TOTAL_VALUE:"82727"}]
				
			},
			function(){
										
			},
			true,
			true,
			'呦!你的保单很多哦!'
		)
}

//保全任务记录
function bq(){
	//$("#bqlb tbody td").empty();
	var contractId = getQueryString('contractId');
	var pstatu='';
	var datefrom='';
	var datato='';
	var par={'status':pstatu,'entryFrom':datefrom,'entryTo':datato}
	padMarketing.ajaxNormal(
			'/pad_marketing/mainten/getMaintenDetailByContractId.action',
			{contractId:contractId},
			function(data){
				//console.log(data);
				var html="";
				var html2="";
				/*html+='<table class="table browser-table table-bordered table-striped table-center table-iframe" id="bqlb">';
				html+='<thead>';
				html+='<tr class="primary">';
				html+='<th>保全项目</th>';
				html+='<th>保全状态</th>';
				html+='<th>照会状态</th>';
				html+='<th>申请方式</th>';
				html+='<th>拒绝/撤销原因</th>';
				html+='<th>申请日期</th>';
				html+='<th>受理完成日期</th>';
				html+='<th>生效日期</th>';
				html+='<th>完成日期</th>';
				html+='</tr>';
				html+='</thead>';
				html+='<tbody>';
				html+='</tbody>';
				html+='</table>';
				$("#bqk").html(html);*/
				if(data.length>0){
					for(var i=0;i<data.length;i++){
						html2+='<tr>';
						html2+='<td>'+$.trim(data[i].MOVEMENT_DESC_C)+'</td>';//保全项目
						html2+='<td>'+$.trim(data[i].TASK_STATUS)+'</td>';//保全状态
						html2+='<td>'+$.trim(data[i].NOTICE_FLAG_CN)+'</td>';//照会状态
						html2+='<td>'+$.trim(data[i].REG_CHANNEL_DESC)+'</td>';//申请方式
						html2+='<td>'+data[i].REJECT_REASON+'</td>';//拒绝/撤销原因
						html2+='<td>'+(data[i].REGISTER_DATE?new Date(data[i].REGISTER_DATE).Format('yyyy-MM-dd'):'')+'</td>';//申请日期
						html2+='<td>'+(data[i].SUBMIT_DATE?new Date(data[i].SUBMIT_DATE).Format('yyyy-MM-dd'):'')+'</td>';//受理完成日期
						html2+='<td>'+(data[i].PS_EFF_DATE?new Date(data[i].PS_EFF_DATE).Format('yyyy-MM-dd'):'')+'</td>';//生效日期
						html2+='<td>'+(data[i].CLOSE_DATE?new Date(data[i].CLOSE_DATE).Format('yyyy-MM-dd'):'')+'</td>';//完成日期
						html2+='</tr>';
					}
					$("#bqlb tbody").html(html2);
					example("bqlb");
					for(var j=0;j<$("#bqlb tbody td").length;j++){
						if($("#bqlb tbody td").eq(j).text()=="undefined"){
							$("#bqlb tbody td").eq(j).text("");
						}
					}
				}
			},
			function(){
										
			},
			true,
			true,
			'呦!你的保单很多哦!'
		)
}

//保单理赔记录
function lp(){
	//$("#lplb tbody td").empty();
	var contractId = getQueryString('contractId');
	var policyData = JSON.parse(sessionStorage.policyData);
	padMarketing.ajaxNormal(
			'/pad_marketing/myPolicy/getPolicyClaim.action',
			{contractId:contractId},
			function(data){
				//console.log(data);
//				data=[{REG_NO:"333",CLAIM_ID:"4444",POLICY_REF:"5555",COVER_CODE:"666",PH_NAME:"777",INSURED_NAME:"888",SUM_INSURED:"999",DATE_OF_LOSS:"000",CAUSE_OF_LOSS:"111",STATUS:"222",DECISION_DESC:"333",NOTCIE_STATUS:"444",OPERATING_DATE:"555",CONFIRM_DATE:"6666"},
//				      {REG_NO:"999",CLAIM_ID:"888",POLICY_REF:"777",COVER_CODE:"666",PH_NAME:"555",INSURED_NAME:"444",SUM_INSURED:"999",DATE_OF_LOSS:"000",CAUSE_OF_LOSS:"111",STATUS:"222",DECISION_DESC:"333",NOTCIE_STATUS:"444",OPERATING_DATE:"555",CONFIRM_DATE:"6666"}];
				var html="";
				var html2="";
				/*html+='<table class="table browser-table table-bordered table-striped table-center table-iframe" id="lplb">';
				html+='<thead>';
				html+='<tr class="primary">';
				html+='<th>理赔号</th>';
				html+='<th>险种代码</th>';
				html+='<th>被保险人</th>';
				html+='<th>保额</th>';
				html+='<th>出险原因</th>';
				html+='<th>理赔状态</th>';
				html+='<th>理赔决定</th>';
				html+='<th>照会状态</th>';
				html+='<th>事故日</th>';
				html+='<th>受理确认日期</th>';
				html+='<th>结案日期</th>';
				html+='</tr>';
				html+='</thead>';
				html+='<tbody>';
				html+='</tbody>';
				html+='</table>';
				$("#lpk").html(html);*/
				if(data.length>0){
					for(var i=0;i<data.length;i++){
						html2+='<tr>';
						html2+='<td>'+$.trim(data[i].CLAIM_ID)+'</td>';//理赔号
						html2+='<td>'+$.trim(data[i].COVER_CODE?data[i].COVER_CODE:policyData.COVER_CODE)+'</td>';//险种代码
						html2+='<td>'+$.trim(data[i].INSURED_NAME)+'</td>';//被保险人
						html2+='<td>'+$.trim(data[i].SUM_INSURED)+'</td>';//保额
						html2+='<td>'+$.trim(data[i].CAUSE_OF_LOSS)+'</td>';//出险原因
						html2+='<td>'+$.trim(data[i].STATUS)+'</td>';//理赔状态
						html2+='<td>'+$.trim(data[i].DECISION_DESC)+'</td>';//理赔决定
						html2+='<td>'+$.trim(data[i].NOTCIE_STATUS)+'</td>';//照会状态
						html2+='<td>'+$.trim(data[i].DATE_OF_LOSS?new Date(data[i].DATE_OF_LOSS).Format("yyyy-MM-dd"):"")+'</td>';//事故日
						html2+='<td>'+$.trim(data[i].OPERATING_DATE?new Date(data[i].OPERATING_DATE).Format("yyyy-MM-dd"):"")+'</td>';//受理确认日期
						html2+='<td>'+$.trim(data[i].CONFIRM_DATE?new Date(data[i].CONFIRM_DATE).Format("yyyy-MM-dd"):"")+'</td>';//结案日期
						html2+='</tr>';
					}
					$("#lplb tbody").html(html2);
					example("lplb");
					for(var j=0;j<$("#lplb tbody td").length;j++){
						if($("#lplb tbody td").eq(j).text()=="undefined"){
							$("#lplb tbody td").eq(j).text("");
						}
					}
				}
			},
			function(){
										
			},
			true,
			true,
			'呦!你的保单很多哦!'
		)
}
